package com.octopus.registry;

import java.lang.reflect.InvocationTargetException;

import com.octopus.json.Json;

public class Call {
	private CallStatus status;
	private MethodIsNullException preException_methodIsNullException;
	private ServiceDoesNotExistException preException_serviceDoesNotExistException;
	private ServiceInvokeNullParameterException preException_serviceInvokeNullParameterException;
	
	private NullPointerException systemException_NullPointerException;
	private ExceptionInInitializerError systemException_ExceptionInInitializerError;
	private InvocationTargetException systemException_InvocationTargetException;
	private IllegalAccessException systemException_IllegalAccessException;
	private IllegalArgumentException systemException_IllegalArgumentException;
	public CallStatus getStatus() {
		return status;
	}
	protected void setStatus(CallStatus status) {
		this.status = status;
	}
	public MethodIsNullException getPreException_methodIsNullException() {
		return preException_methodIsNullException;
	}
	protected void setPreException_methodIsNullException(
			MethodIsNullException preException_methodIsNullException) {
		this.preException_methodIsNullException = preException_methodIsNullException;
	}
	public ServiceDoesNotExistException getPreException_serviceDoesNotExistException() {
		return preException_serviceDoesNotExistException;
	}
	protected void setPreException_serviceDoesNotExistException(
			ServiceDoesNotExistException preException_serviceDoesNotExistException) {
		this.preException_serviceDoesNotExistException = preException_serviceDoesNotExistException;
	}
	public ServiceInvokeNullParameterException getPreException_serviceInvokeNullParameterException() {
		return preException_serviceInvokeNullParameterException;
	}
	protected void setPreException_serviceInvokeNullParameterException(
			ServiceInvokeNullParameterException preException_serviceInvokeNullParameterException) {
		this.preException_serviceInvokeNullParameterException = preException_serviceInvokeNullParameterException;
	}
	public NullPointerException getSystemException_NullPointerException() {
		return systemException_NullPointerException;
	}
	protected void setSystemException_NullPointerException(
			NullPointerException systemException_NullPointerException) {
		this.systemException_NullPointerException = systemException_NullPointerException;
	}
	public ExceptionInInitializerError getSystemException_ExceptionInInitializerError() {
		return systemException_ExceptionInInitializerError;
	}
	protected void setSystemException_ExceptionInInitializerError(
			ExceptionInInitializerError systemException_ExceptionInInitializerError) {
		this.systemException_ExceptionInInitializerError = systemException_ExceptionInInitializerError;
	}
	public InvocationTargetException getSystemException_InvocationTargetException() {
		return systemException_InvocationTargetException;
	}
	protected void setSystemException_InvocationTargetException(
			InvocationTargetException systemException_InvocationTargetException) {
		this.systemException_InvocationTargetException = systemException_InvocationTargetException;
	}
	public IllegalAccessException getSystemException_IllegalAccessException() {
		return systemException_IllegalAccessException;
	}
	protected void setSystemException_IllegalAccessException(
			IllegalAccessException systemException_IllegalAccessException) {
		this.systemException_IllegalAccessException = systemException_IllegalAccessException;
	}
	public IllegalArgumentException getSystemException_IllegalArgumentException() {
		return systemException_IllegalArgumentException;
	}
	protected void setSystemException_IllegalArgumentException(
			IllegalArgumentException systemException_IllegalArgumentException) {
		this.systemException_IllegalArgumentException = systemException_IllegalArgumentException;
	}
	
	public boolean isSuccess(){
		if(this.status != null){
			return this.status.equals(CallStatus.success);
		}else{
			return false;
		}
	}
	
	public boolean isSystemException() {
		return (this.systemException_ExceptionInInitializerError != null
				|| this.systemException_IllegalAccessException != null
				|| this.systemException_IllegalArgumentException != null
				|| this.systemException_NullPointerException != null);
	}
	
	public Throwable getRealCause(){
		if(this.isInvokeException()){
			return this.systemException_InvocationTargetException.getCause();
		}
		return null;
	}
	
	public boolean isInvokeException(){
		return this.systemException_InvocationTargetException != null;
	}
	
	public Object isPreException(){
		return this.preException_methodIsNullException != null
				|| this.preException_serviceDoesNotExistException != null
				|| this.preException_serviceInvokeNullParameterException != null;
	}
	
	public boolean isMethodNull(){
		return this.preException_methodIsNullException != null;
	}
	
	public boolean isServiceNotExist(){
		return this.preException_serviceDoesNotExistException != null;
	}
	
	public boolean isNullParameter(){
		return this.preException_serviceInvokeNullParameterException != null;
	}
	
}
